package com.ccom.test.rabbitmq;

import cn.hutool.core.util.ObjectUtil;
import com.ccom.core.common.model.BaseMap;
import com.ccom.starter.rabbitmq.event.CcomBusEventHandler;
import com.ccom.starter.rabbitmq.event.EventObj;
import com.ccom.test.constant.TestConstant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @Description:
 * @author: jjzhang24
 * @date: 2021年12月17日
 */
@Slf4j
@Component(TestConstant.MQ_DEMO_BUS_EVENT)
public class DemoBusEvent implements CcomBusEventHandler {

    @Override
    public void onMessage(EventObj obj) {
        if (ObjectUtil.isNotEmpty(obj)) {
            BaseMap baseMap = obj.getBaseMap();
            String message = baseMap.get("message");
            log.info("demoBusEvent get message:{}", message);
        }
    }
}
